import pymysql

conn = pymysql.connect(
    host = "192.168.138.99",
    user = "yang",
    passwd = "123456",
    port = 3306,
    db = "log_consumer"
)

cur = conn.cursor()

sql = "DROP TABLE IF EXISTS log"
cur.execute(sql)

sql = """CREATE TABLE log
(
    ip varchar(15) NOT NULL,
    city varchar(10) NOT NULL,
    operator varchar(10) NOT NULL,
    date varchar(10) NOT NULL,
    flow int NOT NULL
)"""
cur.execute(sql)